# coding: utf-8
# @Author: cyl
# @File: 011with.py
# @Time: 2024/08/19 21:59:14


class MyContextManager:
    def __init__(self) -> None:
        self.a = "123"

    def __enter__(self):
        self.a = "456"
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        print(self.a)


# 使用自定义上下文管理器
with MyContextManager() as manager:
    print("Inside the with block")
